@import './variables.scss';

// 全局样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: $font-family-base;
  font-size: $font-size-base;
  font-weight: $font-weight-normal;
  line-height: $line-height-base;
  color: $text-primary;
  background-color: $bg-primary;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// 链接样式
a {
  color: $primary-color;
  text-decoration: none;
  transition: color 0.15s ease-in-out;

  &:hover {
    color: darken($primary-color, 15%);
    text-decoration: underline;
  }
}

// 按钮基础样式
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease-in-out;
}

// 输入框基础样式
input, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border: $border-width solid $border-color;
  border-radius: $border-radius;
  padding: $spacing-sm $spacing-md;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

  &:focus {
    border-color: $primary-color;
    box-shadow: 0 0 0 0.2rem rgba($primary-color, 0.25);
  }
}

// 滚动条样式
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: $bg-secondary;
}

::-webkit-scrollbar-thumb {
  background: $border-color;
  border-radius: 4px;

  &:hover {
    background: darken($border-color, 10%);
  }
}

// 工具类
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 $spacing-md;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.d-flex {
  display: flex;
}

.d-block {
  display: block;
}

.d-none {
  display: none;
}

.justify-content-center {
  justify-content: center;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

// 间距工具类
@for $i from 0 through 5 {
  .m-#{$i} {
    margin: #{$i * 0.25}rem;
  }
  .mt-#{$i} {
    margin-top: #{$i * 0.25}rem;
  }
  .mb-#{$i} {
    margin-bottom: #{$i * 0.25}rem;
  }
  .ml-#{$i} {
    margin-left: #{$i * 0.25}rem;
  }
  .mr-#{$i} {
    margin-right: #{$i * 0.25}rem;
  }
  .mx-#{$i} {
    margin-left: #{$i * 0.25}rem;
    margin-right: #{$i * 0.25}rem;
  }
  .my-#{$i} {
    margin-top: #{$i * 0.25}rem;
    margin-bottom: #{$i * 0.25}rem;
  }
  
  .p-#{$i} {
    padding: #{$i * 0.25}rem;
  }
  .pt-#{$i} {
    padding-top: #{$i * 0.25}rem;
  }
  .pb-#{$i} {
    padding-bottom: #{$i * 0.25}rem;
  }
  .pl-#{$i} {
    padding-left: #{$i * 0.25}rem;
  }
  .pr-#{$i} {
    padding-right: #{$i * 0.25}rem;
  }
  .px-#{$i} {
    padding-left: #{$i * 0.25}rem;
    padding-right: #{$i * 0.25}rem;
  }
  .py-#{$i} {
    padding-top: #{$i * 0.25}rem;
    padding-bottom: #{$i * 0.25}rem;
  }
}

// 响应式工具类
@media (max-width: $breakpoint-sm) {
  .container {
    padding: 0 $spacing-sm;
  }
}